// AI chat view implementation
use iced::{Element, widget::{column, row, text_input, button, text, scrollable}};

/// AI chat view component
pub fn ai_chat_view<'a, Message>(
    prompt: &'a str,
    response: &'a str,
    on_prompt_change: impl Fn(String) -> Message + 'a,
    on_send: Message,
) -> Element<'a, Message>
where
    Message: Clone + 'a,
{
    let prompt_input = text_input("Ask AI about your database...", prompt)
        .on_input(on_prompt_change);

    let send_button = button(text("Send"))
        .on_press(on_send);

    let response_display = scrollable(text(response));

    column![
        row![prompt_input, send_button].spacing(10),
        response_display
    ]
    .spacing(10)
    .into()
}
